<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ include file="/WEB-INF/view/include/inc.jsp"%>
<!DOCTYPE html >
<html>
<head>
<%@ include file="/WEB-INF/view/jQgrid.jsp"%>
    <link rel="stylesheet" href="<%=contextPath %>/static/autosuggest/css/autosuggest.css">
    <script src="<%=contextPath %>/static/autosuggest/js/autosuggest.js"></script>
    <script type="text/javascript" src="<%=contextPath %>/static/kindeditor/kindeditor-all-min.js"></script>
    <script charset="utf-8" src="<%=contextPath %>/static/kindeditor/lang/zh-CN.js"></script>
</head>
<body style="background-color: white;" class="gray-bg">
	<div class="ibox-content">
		<div class="row-fluid">
			<div class="col-sm-12">
				<form class="form-horizontal m-t " id="signupForm" method="post"
					enctype="multipart/form-data">
					<input type="hidden" name="id" value="${workExp.id}" />
					<input type="hidden" name="talentsId" value="${workExp.talentsId}" />
					<div class="form-group">
						<label class="col-sm-2 control-label">起止时间：</label>
						<div class="col-sm-10 form-inline">
							<input type="text" class="form-control datetime"
								id="w_startDate" name="startDate" readonly="readonly"
								placeholder="请选择日期"  value="${workExp.startDate}"/> - 
								<select class="form-control" onchange="chooseDate();" id="choosedate"><option value="0" <c:if test="${workExp.endDate =='至今' }">selected="selected"</c:if>>至今</option><option value="1" <c:if test="${workExp.endDate !='至今' }">selected="selected"</c:if>>选择年月</option></select>
								<input type="text"
								class="form-control datetime" id="w_endDate"
								name="endDate" readonly="readonly" placeholder="请选择日期" value="${workExp.endDate}" <c:if test="${workExp.endDate =='至今' }">style="display:none;"</c:if>/>
								
								
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">公司名称：</label>
						<div class="col-sm-8">
							<input type="text"  class="form-control company" id="w_companyName" name="companyName"  value="${workExp.companyName }" onblur="addDescrpt();"/>
							<input type="hidden"  class="form-control" id="w_companyId" name="companyId" value="${workExp.company.id }" />
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">公司描述：</label>
						<div class="col-sm-10">
						   <textarea rows="3" cols="3" class="form-control" id="w_description"
								name="description">${workExp.description }</textarea>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">工作职能：</label>
						<div class="col-sm-4">
							<input type="text" class="form-control" id="w_job"
								name="job" value="${workExp.job}"/>
						</div>
						<label class="col-sm-2 control-label">职位名称：</label>
						<div class="col-sm-4">
							<input type="text" class="form-control" id="w_position"
								name="position" value="${workExp.position}"/>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">部门名称：</label>
						<div class="col-sm-4">
							<input type="text" class="form-control" id="w_depName"
								name="depName" value="${workExp.depName}"/>
						</div>
						<label class="col-sm-2 control-label">工作地点：</label>
						<div class="col-sm-4">
							<input type="text" class="form-control" id="w_workplace"
								name="workplace" value="${workExp.workplace}"/>
						</div>
					</div>
					<div class="form-group">
					   <label class="col-sm-2 control-label">汇报上级：</label>
						<div class="col-sm-4">
							<input type="text" class="form-control" id="w_report"
								name="report" value="${workExp.report}"/>
						</div>
						<label class="col-sm-2 control-label">下属人数：</label>
						<div class="col-sm-4">
							<input type="number" class="form-control" id="w_subordinateNum"
								name="subordinateNum" value="${workExp.subordinateNum}" onkeyup="onlyNumber(this)" onblur="onlyNumber(this)"/>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">工作职责：</label>
						<div class="col-sm-10">
						<textarea id="responsibility" name="responsibility" >${workExp.responsibility }</textarea>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">工作业绩：</label>
						<div class="col-sm-10">
							<textarea  rows="3" cols="3" class="form-control"
								id="w_performance" name="performance">${workExp.performance}</textarea>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">项目经验：</label>
						<div class="col-sm-10">
						    <textarea rows="3" cols="3" id="w_projectId" name="project" class="form-control">${workExp.project }</textarea>
						</div>
					</div>
					<div class="form-group" style="text-align: center;">
						<div class="col-sm-12">
							<button class="btn btn-primary" type="button" id="sub">提交</button>
							<button class="btn btn-primary" type="button"
								onclick="top.Dialog.close();">取消</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
	<script type="text/javascript">
	KindEditor.ready(function(K){
		K.create('textarea[name="responsibility"]', {
		themeType: 'simple',
		resizeType: 1,
		allowFileManager: true,
		items : [
			'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
			'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
			'insertunorderedlist', '|', 'emoticons', 'image', 'link'],
		afterBlur: function(){this.sync();}
		});
		});
	 $(function () {
		 $("#t_schoolName").autosuggest({
	            url: '<%=contextPath%>/school/getJsonSchool?type=2',
	                minLength: 1,
	                maxNum: 4,
	                align: 'center',
	                method: 'post',
	                highlight: true,
	                immediate: true,
	                queryParamName: 'name',
	                nextStep: function (ele) {
	                    var tid = ele.data('id'); 
	                    $("#t_schoolId").val(tid);
	                },
	                split: ' ',
	                open: function(){
	                    //console.log("start open");
	                },
	                close: function(){
	                    //console.log("start close");
	                }
	            });
		 $('.datetime').datetimepicker({
			    format: 'yyyy-mm',
		        autoclose: true,
		        todayBtn: true,
		        startView: 'year',
		        minView:'year',
		        maxView:'decade',
		        language:  'zh-CN',
	    	    autoclose: 1//选择后自动关闭
		  });
		 //$("#t_startDate").datetimepicker("update",'2002-01-01');//赋值
		 $('#t_startDate1').datetimepicker({
	    	 format: 'yyyy-mm',
		        autoclose: true,
		        todayBtn: true,
		        startView: 'year',
		        minView:'year',
		        maxView:'decade',
		        language:  'zh-CN',
	    	    autoclose: 1//选择后自动关闭
	  }).on('hide', function(event) {
		  var year = event.date.getFullYear();//获取年
		  var newyear = year+3;
		  $("#t_endDate").datetimepicker("update",newyear+'-01');//赋值
		});
        $("#sub").click(function () {
            $("#signupForm").ajaxSubmit({
                url: '<%=contextPath%>/work/editSingle',
                data:{'num':2},
				type : 'post',
				dataType : "json",
				beforeSend: function () {
			        // 禁用按钮防止重复提交
					$("#sub").attr("disabled","disabled");
					swal("信息已经提交，请等待后台处理~！");
			    },
				success : function(data) {
					if (data.code == 200) {
						swal({
							title : data.message,
							type : "success",
							showCancelButton : false,
							confirmButtonText : "确定",
							animation : "slide-from-bottom",
							text: "2秒后自动关闭。", 
	      	    			timer: 2000, 
							closeOnConfirm : true
						}, function() {
							top.Dialog.close();
						});
					} else {
						swal("错误", data.message, "error");
					}  
				},    
				complete: function () {
			        $("#sub").removeAttr("disabled");
			    },
			    error: function (data) {
			    	swal("错误", data.message, "error");
			    }
			});
		});
	});
	</script>
</body>
</html>